# -*- coding:utf-8 -*-
__author__ = 'maruimin'

import xadmin
from xadmin import views

from .models import EmailVerifyRecord, Banner, UserProfile


class GlobalSettings(object):
    site_title = '教务管理系统'
    site_footer = '重庆交通大学'
    menu_style = 'accordion'


xadmin.site.register(views.CommAdminView, GlobalSettings)


class EmailVerifyRecordAdmin(object):
    list_display = ['code', 'email', 'send_type', 'send_time']
    search_fields = ['code', 'email', 'send_type']
    list_filter = ['code', 'email', 'send_type', 'send_time']


xadmin.site.register(EmailVerifyRecord, EmailVerifyRecordAdmin)


class BaseSetting(object):
    enable_themes = True
    use_bootswatch =True


xadmin.site.register(views.BaseAdminView, BaseSetting)



class BannerAdmin(object):
    list_display = ['title', 'image', 'url', 'index', 'add_time']
    search_fields = ['title', 'image', 'url', 'index']
    list_filter = ['title', 'image', 'url', 'index', 'add_time']


xadmin.site.register(Banner, BannerAdmin)


class UserProfileAdmin(object):
    list_display = ['nickname', 'birthday', 'gender', 'address', 'mobile', 'image', 'username', 'email']
    search_fields = ['nickname', 'birthday', 'gender', 'address', 'mobile', 'image']
    list_filter = ['nickname', 'birthday', 'gender', 'address', 'mobile', 'image']

xadmin.site.unregister(UserProfile)
xadmin.site.register(UserProfile, UserProfileAdmin)